package com.liujing.simplefactory;

/**
 * @program: DesignPattenDemo
 * @description:
 * @author: liujing
 * @create: 2019-11-21 10:01
 **/
public class OperationFactory {
    public static Operation createOperation(String operate) {
        Operation operation = null;
        switch (operate) {
            case "+":
                operation = new OperationAdd();
                break;
            case "-":
                operation = new OperationSub();
                break;
            case "*":
                operation = new OperationMul();
                break;
            case "/":
                operation = new OperationDiv();
                break;
            default:
        }
        return operation;
    }
}
